package com.nulldev.util.web.dns.server.server.connector;

import java.io.IOException;

import com.nulldev.util.web.dns.server.server.DNSPayload;

public interface DNSConnector {
	/**
     * Is the connector in blocking or non-blocking mode?
     * @return Duh
     */
    boolean isBlocking();

    /**
     * Reads a DNS message from the connector.
     * @return Payload containing sender address and binary message data
     * @throws java.io.IOException
     */
    DNSPayload read() throws IOException;

    /**
     * Send a DNS message through the connector.
     * @param payload Address of recipient and binary response data
     * @return Number of bytes sent
     * @throws java.io.IOException
     */
    int write(DNSPayload payload) throws IOException;
}
